Debian 8 Jessie
Sponsored Link

Configure iSCSI Initiator
2015/05/06
 
Configure iSCSI Initiator.
This example is based on the environment below.
+----------------------+          |          +----------------------+
| [   iSCSI Target   ] |10.0.0.30 | 10.0.0.31| [ iSCSI Initiator  ] |
|     dlp.srv.world    +----------+----------+   client.srv.world   |
|                      |                     |                      |
+----------------------+                     +----------------------+

[1] Configure iSCSI Initiator.
root@client:~#
aptitude -y install open-iscsi
root@client:~#
vi /etc/iscsi/iscsid.conf
# line 53: uncomment

node.session.auth.authmethod = CHAP
# line 57,58: uncomment and set username and password which set on iSCSI Target

node.session.auth.username =
username

node.session.auth.password =
password
root@client:~#
systemctl restart open-iscsi
# discover target

root@client:~#
iscsiadm -m discovery -t sendtargets -p 10.0.0.30

10.0.0.30:3260,1 iqn.2015-05.world.srv:target00
# confirm status after discovery

root@client:~#
iscsiadm -m node -o show

# BEGIN RECORD 2.0-873
node.name = iqn.2015-05.world.srv:target00
node.tpgt = 1
node.startup = manual
node.leading_login = No
.....
.....
# login to target

root@client:~#
iscsiadm -m node --login

Logging in to [iface: default, target: iqn.2015-05.world.srv:target00, portal: 10.0.0.30,3260] (multiple)
Login to [iface: default, target: iqn.2015-05.world.srv:target00, portal: 10.0.0.30,3260] successful.
# confirm established session

root@client:~#
iscsiadm -m session -o show

tcp: [1] 10.0.0.30:3260,1 iqn.2015-05.world.srv:target00
# confirm partitions

root@client:~#
cat /proc/partitions

major minor  #blocks  name

   2        0          4 fd0
  11        0    1048575 sr0
   8        0  157286400 sda
   8        1     248832 sda1
   8        2          1 sda2
   8        5  157034496 sda5
 254        0  150630400 dm-0
 254        1    6402048 dm-1
   8       16   83886080 sdb
# added new device provided from target as [sdb]

[2] It's possible to use iSCSI device like follows.
root@client:~#
aptitude -y install parted
# create a label

root@client:~#
parted --script /dev/sdb "mklabel msdos"

# create a partition

root@client:~#
parted --script /dev/sdb "mkpart primary 0% 100%"

# format with EXT4

root@client:~#
mkfs.ext4 /dev/sdb1
# mount

root@client:~#
mount /dev/sdb1 /mnt

root@client:~#
df -hT

Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/dm-0      ext4      142G  1.3G  133G   1% /
udev           devtmpfs   10M     0   10M   0% /dev
tmpfs          tmpfs     1.6G  8.6M  1.6G   1% /run
tmpfs          tmpfs     4.0G     0  4.0G   0% /dev/shm
tmpfs          tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs          tmpfs     4.0G     0  4.0G   0% /sys/fs/cgroup
/dev/sda1      ext2      236M   33M  191M  15% /boot
/dev/sdb1      ext4       79G   56M   75G   1% /mnt
 
Tweet